package com.example.demo.Controller;


import com.example.demo.common.AppResult;
import com.example.demo.exception.ApplicationException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

//返回数据
@RestController
@RequestMapping("/test")
public class TestController {
    @RequestMapping("/hello")
    public String hello(){
        return "hello";
    }


    @RequestMapping("/exception")
    public String testException() throws Exception {
        throw new Exception("这是一个Exception...");
    }


    @RequestMapping("/appException")
    public AppResult testApplicationException() throws ApplicationException {
        throw new ApplicationException("这是一个ApplicationException");
    }

}
